/**
 * 
 */
package niuke.toutiao;

import java.util.Scanner;

/**
 * @author zhongfang
 *
 */
public class t2 {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int k = scanner.nextInt() - 1;
		int[] a = new int[n];
		int min = Integer.MAX_VALUE;
		int startIndex = 0;
		for (int i = 0; i < a.length; i++) {
			a[i] = scanner.nextInt();
		}
		// 怎样求最小？
		for (int i = 0; i < a.length; i++) {
			if (a[i] < min) {
				min = a[i];
				startIndex = i;
			} else if (a[i] == min) {
				if (a[(i + 1) % n] > a[i]) {
					startIndex = i;
				}
			}
		}

		// System.out.println(startIndex);
		scanner.close();
		int i = (startIndex + 1) % n;
		int each = a[startIndex];
		boolean addtionalTag = k != startIndex;// 是否有没整除的情况
		while (i != startIndex) {
			a[i] -= each;
			a[startIndex] += each;
			if (addtionalTag) {
				a[i]--;
				a[startIndex]++;
			}
			if (i == k) {// 当前已经是最后一个需要加的
				addtionalTag = false;
			}
			i++;
			if (i == n) {
				i = 0;
			}
		}
		for (int j = 0; j < a.length; j++) {
			if (j != n - 1) {
				System.out.print(a[j] + " ");
			} else {
				System.out.println(a[j]);
			}
		}
	}

}
